package top.gytf.unifiedcall.model.code.builtin;

import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import top.gytf.unifiedcall.jsr269.code.CodeLocationConstants;
import top.gytf.unifiedcall.model.code.SymbolCode;

/**
 * 内置符号码
 */
@CodeLocationConstants
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public enum BuiltinSymbolCode implements SymbolCode {
    /**
     * 成功
     */
    SUCCESS("0", true),
    /**
     * 失败，但是不明确责任方
     */
    FAIL("1"),
    /**
     * 失败，调用方责任
     */
    FAIL_CALLER("2"),
    /**
     * 失败，被调用方责任
     */
    FAIL_CALLEE("3"),
    ;

    private final String value;
    private final boolean success;

    BuiltinSymbolCode(String value) {
        this(value, false);
    }

    @Override
    public String value() {
        return this.value;
    }


    @Override
    public boolean isSuccess() {
        return this.success;
    }
}
